package viewmodel;

import java.util.ArrayList;
import java.util.List;

import admin.dao.ExamsDAO;
import admin.dao.QuestionDAO;

import model.Exams;
import model.Question;


public class QuestionDataModel {
	private List<Question> allQuestion = new ArrayList<Question>();
	
	
	public QuestionDataModel(String id){
		updateAllQuestion(id);
	}

	public List<Question> getAllQuestion() {
		return allQuestion;
	}
	public void updateAllQuestion(String id){
		this.allQuestion = QuestionDAO.getAllQuestion(id);
	}
	public static List<QuestionEditStatus> convertQuesToEditData(List<Question> listQues){
		ArrayList<QuestionEditStatus> result = new ArrayList<QuestionEditStatus>();
		for(Question ques : listQues){
			QuestionEditStatus quesEdit = new QuestionEditStatus(ques, false);
			result.add(quesEdit);
		}
		return result;
	}
	public List<QuestionEditStatus> convertQuesToEditData(){
		return QuestionDataModel.convertQuesToEditData(allQuestion);
	}
	
	public static void main(String[] args) {
		ArrayList<Question> listq = (ArrayList<Question>) QuestionDAO.getAllQuestion("gt_t1");
		for(Question a : listq){
			System.out.println(a.getCauhoi());
		}
	}
}
